<html><head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Definition" rel="Chapter" href="Definition.html"><title>Definition.repartition</title>
</head>
<body>
<code class="code"><span class="keyword">let</span>&nbsp;repartition&nbsp;nb_joueurs=<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span>&nbsp;nb_joueurs&nbsp;&lt;&nbsp;<span class="constructor">Regles</span>.nb_joueurs_min<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">then</span>&nbsp;failwith&nbsp;(<span class="constructor">Printf</span>.sprintf&nbsp;<span class="string">"Le&nbsp;nombre&nbsp;de&nbsp;joueurs&nbsp;est&nbsp;insuffisant&nbsp;pour&nbsp;attribuer&nbsp;correctement&nbsp;les&nbsp;rôles"</span>)&nbsp;<span class="comment">(*Règle&nbsp;n°6*)</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;rep=&nbsp;generer_ordre_aleatoire&nbsp;nb_joueurs&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*on&nbsp;a&nbsp;désormais&nbsp;un&nbsp;tableau&nbsp;aléatoire&nbsp;avec&nbsp;les&nbsp;id&nbsp;des&nbsp;joueurs*)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;rep2=<span class="constructor">Array</span>.make&nbsp;nb_joueurs&nbsp;<span class="constructor">Villageois</span>&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">for</span>&nbsp;i=0&nbsp;<span class="keyword">to</span>&nbsp;nb_joueurs-1&nbsp;<span class="keyword">do</span>&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span>&nbsp;carte_LG&nbsp;nb_joueurs&nbsp;i&nbsp;<span class="keyword">then</span>&nbsp;rep2.(i)&lt;-&nbsp;<span class="constructor">Loup</span>&nbsp;<span class="keyword">else</span>&nbsp;()&nbsp;<span class="comment">(*si&nbsp;le&nbsp;joueur&nbsp;pioche&nbsp;les&nbsp;premières&nbsp;cartes&nbsp;du&nbsp;paquet,&nbsp;il&nbsp;est&nbsp;LG&nbsp;!*)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">done</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;rep2.(1)&lt;-&nbsp;<span class="constructor">Voyante</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;rep2.(2)&lt;-&nbsp;<span class="constructor">Sorciere</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;rep3=<span class="constructor">Array</span>.make&nbsp;nb_joueurs&nbsp;<span class="constructor">Unknown</span>&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">for</span>&nbsp;i=0&nbsp;<span class="keyword">to</span>&nbsp;nb_joueurs-1&nbsp;<span class="keyword">do</span>&nbsp;rep3.(rep.(i))&lt;-rep2.(i)&nbsp;<span class="keyword">done</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;rep3</code></body></html>